<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas width="800" height="800"></canvas>
    <script>
        let canvas = document.querySelector('canvas');
        let ctx = canvas.getContext('2d');

        // 通过ctx.strokeStyle与sct.fillStyle可以进行颜色的修改，可以改一次画一次。
        // 赋值和大多数色彩一样，支持字符串、rgb、#、rgba(r,g,b,a)四种方式。
        ctx.strokeStyle = 'red';
        ctx.strokeRect(200,200,300,200,300,300,200,300);
        ctx.strokeStyle = '#409EFF';
        ctx.strokeRect(100,100,200,100,200,200,100,200);
        ctx.fillStyle = 'rgb(225, 243, 216)';
        ctx.fillRect(300,300,400,300,400,400,300,400);
    </script>
</body>
</html>